import ImagePicker from 'react-native-image-crop-picker';
import Action from '../comm/action';

var config = {
    width: 720,
    height: 720,
    cropping: true
};

/**
 * 拍照
 */
export function takePhoto(callback) {
    return ImagePicker.openCamera(config).then(image => {
        Action.upload(image.path).then(data=> {
            console.log(data)
            callback(data.path)
        })
    });
}

/**
 * 从相册选择
 */
export function fromAlbum(callback) {
    return ImagePicker.openPicker(config).then(image => {
        Action.upload(image.path).then(data=> {
            console.log(data)
            callback(data.path)
        })
    });
}
